<?php
	include("scripts/connection.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Script-Type" content="text/javascript" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection, tv" />
<!--[if lte IE 6]><link rel="stylesheet" type="text/css" href="css/style-ie.css" media="screen, projection, tv" /><![endif]-->
<link rel="stylesheet" href="css/style-print.css" type="text/css" media="print" />

<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<script type="text/javascript">
function getTeacher()
{
	var e1 = document.getElementById('teachers');
	
	var optionArray=[];

	<?php
	$result = mysql_query("SELECT * FROM user WHERE user_status=3");
	while($row = mysql_fetch_array($result))
	{
	?>
		optionArray.push("<?php echo $row['user_id']."|".$row['user_name']." ".$row['user_surname']; ?>");
	<?php
	}
	?>

	for(var option in optionArray)
	{
		var pair = optionArray[option].split('|');
		var newOption = document.createElement("option");
		newOption.value = pair[0];
		newOption.innerHTML = pair[1];
		e1.options.add(newOption);
	}
}
function getInfo(id1, id2, id3)
{
	var e1 = document.getElementById(id1);
	var e2 = document.getElementById(id2);
	var e3 = document.getElementById(id3);
	
	e2.innerHTML="";
	e3.innerHTML="";
	
	if(e1.value == "engineering")
	{
		var optionArray1 = ["a_03|A_03", "b_03|B_03"];
		var optionArray2 = ["javaSE|Java SE", "introWEB|Introduction to WEB"];
	}
	else if(e1.value == "economic")
	{
		var optionArray1 = ["a_03|A_03", "b_03|B_03"];
		var optionArray2 = ["bank|Bank", "introECO|Introduction to ECONOMIC"];
	}
	else if(e1.value == "law")
	{
		var optionArray1 = ["a_03|A_03", "b_03|B_03"];
		var optionArray2 = ["law|Law", "introLaw|Introduction to LAW"];
	}
	else if(e1.value == "philology")
	{
		var optionArray1 = ["a_03|A_03", "b_03|B_03"];
		var optionArray2 = ["law|Law", "introLaw|".concat("<?php echo "Hello"; ?>")];
	}
	
	for(var option in optionArray1)
	{
		var pair = optionArray1[option].split('|');
		var newOption = document.createElement("option");
		newOption.value = pair[0];
		newOption.innerHTML = pair[1];
		e2.options.add(newOption);
	}
	for(var option in optionArray2)
	{
		var pair = optionArray2[option].split('|');
		var newOption = document.createElement("option");
		newOption.value = pair[0];
		newOption.innerHTML = pair[1];
		e3.options.add(newOption);
	}	
}

function check()
{
	var t = document.getElementById("teachers").value;
	var f = document.getElementById("faculty").value;
	var g = document.getElementById("groups").value;
	var l = document.getElementById("lessons").value;
	var tip1 = document.getElementById("tip1").checked;
	var tip2 = document.getElementById("tip2").checked;
	var tip3 = document.getElementById("tip3").checked;
		
	if(t && f && g && l && (tip1 || tip2 || tip3))
	{
		document.forms["form"].submit();
	}	
}
</script>

<title>SDU</title>
</head>

<body onload="getTeacher()">

<div id="wrapper">
		<?php
			include("header.php");
		?>
<div id="content-box-left">
	<div id="content-box-left-in">
		<div class="paging" title="" align='center'>
				<div class="box">
					<div id="box-in">
						<div class="article">
							<h2 align='center'>REGISTRATION</h2><br>	
								<form action="scripts/manager_registration_for_teachers.php" method="post" id="form"><br>
									<table align="center" cellpadding="10" cellspacing="10" >
									<tr>
										<td>teachers :</td>
										<td>
										<select id="teachers" name="teacher">
											<option value="">Select</option>
										</select>
										</td>
									</tr>
									<tr>
										<td>faculty :</td>
										<td>
										<select id="faculty" name="faculty" onchange="getInfo(this.id, 'groups', 'lessons')">
											<option value="">Select</option>
											<option value="engineering">ENGINEERING</option>
											<option value="economic">ECONOMIC</option>
											<option value="law">LAW</option>
											<option value="philology">PHILOLOGY</option>
										</select>
										</td>
									</tr>
									<tr>
										<td>groups :</td>
										<td>
										<select id="groups" name="group"></select>
										</td>
									</tr>
									<tr>
										<td>less name :</td>
										<td>
											<select id="lessons" name="lesson"></select>
										</td>
									</tr>						  
									<tr>
										<td>type lesson :</td>
                                        <td><input type="checkbox" id="tip1" name="tip[]" value="lab"> Lab</td>
                                    </tr>
                                    <tr>
										<td>
										</td>
										<td><input type="checkbox" id="tip2" name="tip[]" value="lecture"> Lecture</td>
                                    </tr>
                                    <tr>
										<td>
										</td>
                                        <td><input type="checkbox" id="tip3" name="tip[]" value="practice"> Practice</td>
                                    </tr>
										<td>
										</td>
										<td><input onclick="check()" type="button" value="OK"/></td>
									</table>
							</form>
								</div>
							</div>
						</div>
						</div>
					</div>	
					</div>
			</div>
</body>
</html>